﻿using Sustainalytics.Common.Hosting;
using Sustainalytics.Utils.Serilog;
using Sustainalytics.WebApiHosting;

namespace Sustainalytics.PdfGeneration.Service.Infrastructure
{
    public class PdfGenerationApplication: ServiceApplication
    {
        public PdfGenerationApplication() : base()
        {

        }

        public PdfGenerationApplication(IBasicLogger logger) : base(logger)
        {

        }

        protected override void AddStartupServices()
        {
            RegisterService(new WebApiServiceDefinition<Startup>(HostConfig.GetHostUrl(), "pdfGeneration"));

        }

        protected override bool HandleStartException(System.Exception e)
        {
            CommonEventSerilog.Log.ApplicationStartError(e);
            return false;
        }

        protected override bool HandleStopException(System.Exception e)
        {
            CommonEventSerilog.Log.ApplicationStopError(e);
            return false;
        }

      
        protected override void OnUnhandledDomainException(System.Exception e)
        {
            CommonEventSerilog.Log.OnUnhandledDomainException(e);
        }
    }
}
